package facade

import (
	"example.com/m/v2/internal/application/service"
	"example.com/m/v2/internal/interfaces/assembler"
	"example.com/m/v2/internal/interfaces/dto"
	"github.com/gin-gonic/gin"
)

type AccountFacade struct {
	accountAppService *service.AccountAppService
}

func NewAccountFacade(accountAppService *service.AccountAppService) *AccountFacade {
	return &AccountFacade{
		accountAppService,
	}
}

func (srv *AccountFacade) FindMainAccount(ctx *gin.Context, mainAccountId uint) (*dto.MainAccountDto, error) {
	account, err := srv.accountAppService.FindMainAccount(ctx, mainAccountId)
	if err != nil {
		return nil, err
	}
	return assembler.ConvertToMainAccountDto(account), nil
}
